<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}

class table_city_deal_commodity extends common_table
{
	public function __construct() {

		$this->_table = 'city_deal_commodity';
		$this->_pk    = 'iid';

		parent::__construct();
	}
	 
	public function add_commodity($data, $return_insert_id = false){
		if($data && is_array($data)){
			return DB::insert($this->_table, $data, $return_insert_id = false);
		}
		return 0;
	}
	public function del_commodity($data){
		if($data){
			return DB::delete($this->_table, $data);
		}
		return 0;
	}
	public function fetch_by_iid($cid){
		return DB::fetch_all('SELECT * FROM %t WHERE cid=%d ', array($this->_table,$cid));
	}
	public function fetch_all_by_iid($iid){
		if(!empty($iid)&&$iid){
			return DB::fetch_all('SELECT * FROM %t WHERE iid=%s',array($this->_table,$iid));//返回数组包含各个字段的值
		}
		return false;
	}
}

?>
